﻿//using Microsoft.EntityFrameworkCore;
//using System.Collections.Generic;
//using System.Threading.Tasks;
//using Volo.Abp.Domain.Entities;
//using Volo.Abp.Domain.Repositories;
//using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
//using Xms.Abp.Domain.Repositories;

//namespace Xms.Abp.Storage;

//public class XmsStorageAttachProvider : IAttachProvider
//{
//    private static async Task<DbSet<TEntity>> GetDbSetAsync<TEntity>(IRepository<TEntity> repository)
//        where TEntity : class, IEntity
//    {
//        if (repository is IEfCoreRepository<TEntity> repo)
//        {
//            return await repo.GetDbSetAsync();
//        }
//        return null;
//    }

//    public async Task AttachAsync<TEntity>(IRepository<TEntity> repository, TEntity entity)
//        where TEntity : class, IEntity
//    {
//        (await GetDbSetAsync(repository))?.Attach(entity);
//    }

//    public async Task AttachAsync<TEntity>(IRepository<TEntity> repository, IEnumerable<TEntity> entities)
//        where TEntity : class, IEntity
//    {
//        (await GetDbSetAsync(repository))?.AttachRange(entities);
//    }
//}

